/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.oa.service;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;

import com.thinkgem.jeesite.modules.oa.dao.OrderQryDao;

import com.thinkgem.jeesite.modules.oa.entity.OrderQryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 通知通告Service
 * @author ThinkGem
 * @version 2014-05-16
 */
@Service
@Transactional(readOnly = true)
public class OrderQryService extends CrudService<OrderQryDao, OrderQryVo> {

	@Autowired
	private OrderQryDao orderQryDao;

	public OrderQryVo get(String id) {
		OrderQryVo entity = orderQryDao.get(id);
		return entity;
	}
	
//	/**
//	 * 获取通知发送记录
//	 * @param oaNotify
//	 * @return
//	 */
//	public OaCarQryVo getRecordList(OaCarQryVo oaCarQryVo) {
//		oaNotify.setOaNotifyRecordList(oaNotifyRecordDao.findList(new OaNotifyRecord(oaNotify)));
//		return oaNotify;
//	}
	
	public Page<OrderQryVo> find(Page<OrderQryVo> page, OrderQryVo oaCarQryVo) {
		oaCarQryVo.setPage(page);

		List<OrderQryVo> list = orderQryDao.findList(oaCarQryVo);
		for(OrderQryVo vo  : list){
			vo.setRn(vo.getRn() + (page.getPageNo() - 1)* page.getPageSize());
		}
		page.setList(list);
		return page;
	}
	
	/**
	 * 获取通知数目
	 * @param oaCarQryVo
	 * @return
	 */
	public Long findCount(OrderQryVo oaCarQryVo) {
		return orderQryDao.findCount(oaCarQryVo);
	}

}